<%-- 
    Document   : show_account_statement
    Created on : Sep 20, 2012, 4:33:18 PM
    Author     : faizal.azlee
--%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display" %>
<%@page contentType="text/html" pageEncoding="windows-1252"%>
<%@ include file="/WEB-INF/jsp/include/page_header.jspf" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Penyata Akaun</title>
        <script type="text/javascript">
            $(document).ready(function(){
                $('form').submit( function () {
                    return formValidation();
                }); 
                
                 function getLastMonths(n) {
    
                    var months = new Array();
                    var today = new Date();
                    var year = today.getFullYear();
                    //var year = 2014 
                    var month = today.getMonth() + 1;
                    //var month = 5; 
                    var month2 = month;
                    var i = 0;
                    
                    if (month <= 2) {
                        do {
                            //months.push(year + (month > 9 ? "" : "0") + month);
                            //months.push(month + (year + (month > 9 ? "" : "0")));
                            months.push((month > 9 ? "" : "0") + month + " - "+ year);
                            // 06 - 2014
                            if(month == 1) {
                                month = 12;
                                year--;
                            } else {
                                month--;
                            }
                            
                            i++;
                        } while(i < month2);
                    } else {
                        do {
                            //months.push(year + (month > 9 ? "" : "0") + month);
                            //months.push(month + (year + (month > 9 ? "" : "0")));
                            months.push((month > 9 ? "" : "0") + month + " - "+ year);
                            // 06 - 2014
                            if(month == 1) {
                                month = 12;
                                year--;
                            } else {
                                month--;
                            }
                            i++;
                        } while(i < n);
                    }
                    

                    return months;

                }


                function writeMonthOptions() {   

                   var optionValues = getLastMonths(3);
                   var dropDown = document.getElementById("bulanPilihan");

                   for(var i=0; i<optionValues.length; i++) {
                       //var key = optionValues[i].slice(1,3);
                       var v = optionValues[i].slice(0,2)+optionValues[i].slice(5,9);//wil return MMyyyy format
                      // var key = optionValues[i]; ori
                       var key = v;
                       var value = optionValues[i];
                       dropDown.options[i] = new Option(value, key);
                    }
                    $("#stmt").hide();
                }

          
                writeMonthOptions();
             
            });
            
             function popup(){
                var url = '${pageContext.request.contextPath}/deposit?genReportsPenyataAkaun';
                window.open(url);
            }
            
            
        </script>
    </head>
    <body>
        <s:form beanclass="th.stripes.action.DepositActionBean" class="niceform">
            <div id="content">
                <div id="logo">
                    <span>
                        <img src="${pageContext.request.contextPath}/images/img/ribbon.png"/>               
                    </span>
                </div>
                <h3>
                    Penyata Akaun
                </h3>
              <!--  <p>
                    <label>Nama :</label> ${actionBean.deposit.nama}
                </p>                 </p>-->

               <!-- <p>
                    <label>Tarikh :</label> <fmt:formatDate value="${actionBean.deposit.tarikhTransaksi}" pattern="dd/MM/yyyy"/>
                </p>-->
                             <!--  <p>

                <p>
                    <label>No. Akaun TH :</label> ${actionBean.deposit.noAkaun}
                </p>
                <p>
                    <label>No. KP Semasa :</label> ${actionBean.deposit.noKp}
                </p>
                <p  style="height: 15px;">
                    <label>Alamat :</label>${actionBean.deposit.alamat1}        
                </p>
                <p style="height: 15px;">
                    <label>&nbsp; </label>${actionBean.deposit.alamat2}         
                </p>
                <p style="height: 15px;">
                    <label>&nbsp; </label>${actionBean.deposit.alamat3}         
                </p>
                <p style="height: 15px;">
                    <label>&nbsp; </label>${actionBean.deposit.poskod}
                </p>
                <p style="height: 15px;">
                    <label>&nbsp; </label>${actionBean.deposit.negeriDesc}
                </p> -->
                <br>   
                 <p>
                    <label>No. Akaun TH :</label>
                    <s:select name="deposit.noAkaunDari" class="required" id="noAkaunDari">
                        <s:option value="">Sila Pilih</s:option>
                        <c:forEach items="${actionBean.accountList}" var="item">
                            <s:option value="${item.akaunTmbhn}">${item.akaunTmbhn}</s:option>
                        </c:forEach>
                    </s:select>
                </p>   
                <p>
                    <label>No. KP Semasa :</label>
                    <s:text name="deposit.noKpDari" id="noKpDari" readonly="true"/>
                </p>
                 <p>
                    <label>Bulan :</label>
                    <s:select id="bulanPilihan" name="deposit.bulanPilihan">
                    </s:select>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                  
                    <s:submit  name="checkStatement" value="Semak"  class="button green button_blockUI"/>
                <p>
                    <label></label>
                    <font size="2">Nota : <br/>Paparan penyata adalah bagi 3 bulan terkini untuk tahun semasa.</font>
                </p>
                
                
                
                <p>
                    <div style='overflow-x:auto;overflow-y:auto;width:100%'> 
                        <display:table name="${actionBean.deposit.senaraiTransaksiAkaun}" class="tablecloth" id="row" style="width:100%">
                            <display:column title="Bil" class="fColor">${row_rowNum}</display:column>
                            <display:column title="Tarikh Transaksi">                            
                                <fmt:formatDate value="${row.tarikhTransaksi}" pattern="dd/MM/yyyy"/>
                            </display:column> 
                            <display:column property="butiran" title="Butiran"/>
                            <%--<display:column style="width:25px"></display:column>--%>
                            <display:column title="Wang Keluar(RM)" style="width:110px;text-align:right;"><fmt:formatNumber value="${row.keluar}" pattern="#,###.00"/></display:column>
                            <%--<display:column style="width:25px"></display:column>--%>
                            <display:column title="Wang Masuk(RM)" style="width:110px;text-align:right;"><fmt:formatNumber value="${row.masuk}" pattern="#,###.00"/></display:column>
                            <%--<display:column style="width:25px"></display:column>--%>
                            <display:column title="Baki (RM)" style="width:120px;text-align:right;"><fmt:formatNumber value="${row.baki}" pattern="#,###.00"/></display:column>
                        </display:table>
                    </div>
                </p>
                <p align="center">
                    <%--<s:button name="mainPage" value="HALAMAN UTAMA"/>--%>
                    <s:button name="print" value="Cetak" onclick="popup()" class="button green"/>
                </p>
            </div>
        </s:form>
    </body>
</html>
